/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vamprest;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author sav
 */
@Entity
@Table(name = "userequest")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Userequest.findAll", query = "SELECT u FROM Userequest u"),
    @NamedQuery(name = "Userequest.findByIduserequest", query = "SELECT u FROM Userequest u WHERE u.iduserequest = :iduserequest"),
    @NamedQuery(name = "Userequest.findByTimestamp", query = "SELECT u FROM Userequest u WHERE u.timestamp = :timestamp"),
    @NamedQuery(name = "Userequest.findByRequeststatus", query = "SELECT u FROM Userequest u WHERE u.requeststatus = :requeststatus")})
public class Userequest implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "iduserequest")
    private Integer iduserequest;
    @Basic(optional = false)
    @NotNull
    @Column(name = "timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timestamp;
    @Lob
    @Size(max = 65535)
    @Column(name = "comment")
    private String comment;
    @Basic(optional = false)
    @NotNull
    @Column(name = "requeststatus")
    private int requeststatus;
    @JoinColumn(name = "idnfcequipment", referencedColumnName = "idnfcequipment")
    @ManyToOne(optional = true)
    private Nfcequipment idnfcequipment;
    @JoinColumn(name = "idvehicle", referencedColumnName = "idvehicle")
    @ManyToOne(optional = true)
    private Vehicle idvehicle;
    @JoinColumn(name = "idmember", referencedColumnName = "idmember")
    @ManyToOne(optional = false)
    private Member idmember;

    public Userequest() {
    }

    public Userequest(Integer iduserequest) {
        this.iduserequest = iduserequest;
    }

    public Userequest(Integer iduserequest, Date timestamp, int requeststatus) {
        this.iduserequest = iduserequest;
        this.timestamp = timestamp;
        this.requeststatus = requeststatus;
    }

    public Vehicle getIdvehicle() {
        return idvehicle;
    }

    public void setIdvehicle(Vehicle idvehicle) {
        this.idvehicle = idvehicle;
    }

    public Integer getIduserequest() {
        return iduserequest;
    }

    public void setIduserequest(Integer iduserequest) {
        this.iduserequest = iduserequest;
    }

    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public int getRequeststatus() {
        return requeststatus;
    }

    public void setRequeststatus(int requeststatus) {
        this.requeststatus = requeststatus;
    }

    public Nfcequipment getIdnfcequipment() {
        return idnfcequipment;
    }

    public void setIdnfcequipment(Nfcequipment idnfcequipment) {
        this.idnfcequipment = idnfcequipment;
    }

    public Member getIdmember() {
        return idmember;
    }

    public void setIdmember(Member idmember) {
        this.idmember = idmember;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iduserequest != null ? iduserequest.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Userequest)) {
            return false;
        }
        Userequest other = (Userequest) object;
        if ((this.iduserequest == null && other.iduserequest != null) || (this.iduserequest != null && !this.iduserequest.equals(other.iduserequest))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vamprest.Userequest[ iduserequest=" + iduserequest + " ]";
    }

}
